package cn.daniellee.plugin.bg;

import cn.daniellee.plugin.bg.command.GeneratorCommand;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class BonanzaGenerator extends JavaPlugin {

	private static BonanzaGenerator instance;

	private String prefix;

	@Override
	public void onEnable() {
		instance = this;

		getLogger().info(" ");
		getLogger().info(">>>>>>>>>>>>>>>>>>>>>>>> BonanzaGenerator Loaded <<<<<<<<<<<<<<<<<<<<<<<<");
		getLogger().info(">>>>> If you encounter any bugs, please contact author's QQ: 768318841 <<<<<");
		getLogger().info(" ");

		loadConfig();

		Bukkit.getPluginCommand("bonanzagenerator").setExecutor(new GeneratorCommand());
	}

	public void loadConfig() {
		getLogger().info("Loading config...");
		if(!getDataFolder().exists()) getDataFolder().mkdirs();
		// 载入插件基本配置
		prefix = "&7[&6" + getConfig().getString("prompt-prefix", "BonanzaGenerator") + "&7] &3: &r";
		saveDefaultConfig();
	}

	@Override
	public void onDisable() {
		getLogger().info(" ");
		getLogger().info(">>>>>>>>>>>>>>>>>>>>>>>> BonanzaGenerator Unloaded <<<<<<<<<<<<<<<<<<<<<<<<");
		getLogger().info(" ");
	}

	public static BonanzaGenerator getInstance() {
		return instance;
	}

	public String getPrefix() {
		return prefix;
	}
}
